package com.hqq.thread.thread_pool;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Worker
 * Created by heqianqian on 2017/7/1.
 */
public class Worker implements Runnable {

    private static final Logger LOGGER = LoggerFactory.getLogger(Worker.class);

    private Task task;

    public Worker(Task task) {
        this.task = task;
    }

    @Override
    public void run() {
        LOGGER.info("{} process {}", Thread.currentThread().getName(), this.toString());

        try {
            Thread.sleep(task.getTimeMs());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
